//路由规则  
const express = require('express');

//
const app = express();

//创建路由规则  /home   
app.get('/home', (request, response) => {
    response.setHeader('Content-type','text/html;charset=utf-8');
    response.end('首页');
});

//post
app.post('/login', (request, response) => {
    response.end('login');
});

//put patch
//all 方法  所有
app.all('/admin', (request, response) => {
    response.end('admin page');
});

//404 配置  * 所有 通配符
app.all('*', (request, response) => {
    response.statusCode = 404;
    response.end('<h1>404 Not Found</h1>');
});

app.listen(80, () => {
    console.log('服务已经启动....');
});